package com.learn.algorithm_may_2;

/**
 * Created by QI.
 * 2020/5/8 23:30
 */
public class TestFooBar {

    public static void main(String[] args) {
        new TestFooBar().test();
    }

    public void test(){
        FooBar fooBar = new FooBar(50);
        Runnable r1 = () -> System.out.print("foo");
        Runnable r2 = () -> System.out.print("bar");

        new Thread( () -> {
            try {
                fooBar.foo(r1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } ).start();

        new Thread( () -> {
            try {
                fooBar.bar(r2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } ).start();
    }

}
